package com.dt.common.validation.definition;

import com.dt.common.validation.annotation.NotNull;
import com.dt.common.validation.impl.DefaultValidationDefinition;
import com.dt.common.validation.itf.ConstraintValidation;
import com.dt.common.validation.itf.ValidationContext;

public class NotNullDefinition extends DefaultValidationDefinition {

	public NotNullDefinition() {
		this.name = NotNull.class.getSimpleName();
	}
	
	@Override
	public ConstraintValidation buildValidation() {

		return new ConstraintValidation() {

			@Override
			public boolean isValid(ValidationContext context, Object objectValue, Object propertyValue) {
				if (propertyValue == null) {
					return false;
				}

				return true;
			}

		};

	}

}
